using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Ent.Web;
using System.Collections.Generic;
public partial class Controls_CreateQuery : Ent.Web.WebControl.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            divJavascript.InnerHtml = Javascript.ReadAllText(Server.MapPath("Javascripts/CreateQuery.js"), new string[] { "ctl00_holder_" + ID + "_" });
            PopuplateControls();
        }
        catch (Exception exc)
        {
            //
        }
    }
    public override void SetEvents() { }
    public override void AddJavascript() { }
    public void PopuplateControls() { }
    public override void Init()
    {
        foreach (string key in Values.Keys)
        {
            string noIdkey = key.Replace(ID + "_", "");
            switch (noIdkey)
            {
                case "txtQuestion":
                    txtQuestion.Text = Values[key].ToString();
                    break;
                case "txtOptions":
                    string[] options = (string[])Values[key];
                    foreach (string s in options)
                    {
                        hdnOptions.Value += "{{" + s + "}}";
                    }
                    break;
                default:
                    break;
            }
        }
    }
    public override void Dispose()
    {
        //throw new Exception("The method or operation is not implemented.");
    }
    public override Dictionary<string, object> GetValues()
    {
        string _question = txtQuestion.Text;
        string[] _options = hdnOptions.Value.Split(new string[] { "}}", "{{" }, StringSplitOptions.RemoveEmptyEntries);
        Dictionary<string, object> retValue = new Dictionary<string, object>();
        retValue.Add(ID + "_txtQuestion", _question);
        retValue.Add(ID + "_txtOptions", _options);
        return retValue;
    }
}
